﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:System="clr-namespace:System;assembly=mscorlib"
                    xmlns:controls="clr-namespace:Corina.Controls.Silverlight;assembly=Corina.Controls.Silverlight"
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                    mc:Ignorable="d">

    <!--  Global Settings.  -->
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Brushes.xaml" />
        <ResourceDictionary Source="Fonts.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <!--  Shared Effects.  -->
    <DropShadowEffect x:Key="ControlTextEffect"
                      BlurRadius="0"
                      Direction="293"
                      Opacity="0.5"
                      ShadowDepth="1"
                      Color="White" />
    <DropShadowEffect x:Key="TextEffect"
                      BlurRadius="5"
                      Direction="293"
                      Opacity="0.25"
                      ShadowDepth="0"
                      Color="Black" />
    <DropShadowEffect x:Key="ControlShadowEffect"
                      BlurRadius="3"
                      Direction="-90"
                      Opacity="0.55"
                      ShadowDepth="1"
                      Color="#000000" />
    <DropShadowEffect x:Key="LightControlShadowEffect"
                      BlurRadius="4"
                      Opacity="0.5"
                      ShadowDepth="1"
                      Color="#55524f" />
    <DropShadowEffect x:Key="HeaderTextEffect"
                      BlurRadius="0"
                      Direction="293"
                      Opacity="0.5"
                      ShadowDepth="1"
                      Color="White" />

    <!--  Default Font and Text Settings in UserControl.  -->
    <Style TargetType="UserControl">
        <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
        <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
        <Setter Property="TextOptions.TextHintingMode" Value="Animated" />
    </Style>

    <!--
        ***************************************************************************
        Button
        ***************************************************************************
    -->

    <Style TargetType="Button">
        <Setter Property="Padding" Value="18,6" />
        <Setter Property="TextOptions.TextHintingMode" Value="Animated" />
        <Setter Property="Foreground" Value="{StaticResource ControlForeground}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid x:Name="Root">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.1" />
                                    <VisualTransition To="Pressed" />
                                    <VisualTransition From="Pressed" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="PressedElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="MouseOverElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="NormalElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0.25" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="PressedElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="MouseOverElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="NormalElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="DisabledElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="HighlightElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0.5" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="ContentHost"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0.75" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="FocusVisualElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="DisabledElement"
                                Background="{StaticResource DisabledBrush}"
                                CornerRadius="2"
                                Opacity="0">
                            <Border BorderBrush="{StaticResource DisabledBorderBrush}"
                                    BorderThickness="0,0,1,1"
                                    CornerRadius="2" />
                        </Border>
                        <Border x:Name="NormalElement"
                                Background="{StaticResource ControlBackgroundNormal}"
                                CornerRadius="2"
                                Effect="{StaticResource ControlShadowEffect}" />
                        <Border x:Name="MouseOverElement"
                                Background="{StaticResource ControlBackgroundOver}"
                                CornerRadius="2"
                                Opacity="0" />
                        <Border x:Name="PressedElement"
                                Background="{StaticResource ControlBackgroundPressed}"
                                CornerRadius="2"
                                Opacity="0" />
                        <Border x:Name="HighlightElement"
                                BorderBrush="{StaticResource ControlHighlight}"
                                BorderThickness="1,1,0,0"
                                CornerRadius="2" />
                        <ContentPresenter x:Name="ContentHost"
                                          Margin="{TemplateBinding Padding}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <ContentPresenter.Effect>
                                <DropShadowEffect BlurRadius="1"
                                                  Direction="-90"
                                                  Opacity="0.5"
                                                  ShadowDepth="1"
                                                  Color="{StaticResource ColorForegroundShadowColor}" />
                            </ContentPresenter.Effect>
                        </ContentPresenter>
                        <Rectangle x:Name="FocusVisualElement"
                                   Margin="1"
                                   IsHitTestVisible="False"
                                   Opacity="0"
                                   RadiusX="1"
                                   RadiusY="1"
                                   Stroke="{StaticResource FocusVisualBrush}"
                                   StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        GreenButton
        ***************************************************************************
    -->

    <Style x:Key="GreenButton" TargetType="Button">
        <Setter Property="Padding" Value="18,6" />
        <Setter Property="Foreground" Value="{StaticResource ControlForegroundGreen}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid x:Name="Root">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.1" />
                                    <VisualTransition To="Pressed" />
                                    <VisualTransition From="Pressed" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="PressedElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="MouseOverElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="NormalElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0.25" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="PressedElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="MouseOverElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="HighlightElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0.5" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="NormalElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="DisabledElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="HighlightElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0.5" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="ContentHost"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0.65" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="FocusVisualElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="DisabledElement"
                                Background="{StaticResource DisabledBrush}"
                                CornerRadius="2"
                                Opacity="0">
                            <Border BorderBrush="{StaticResource DisabledBorderBrush}"
                                    BorderThickness="0,0,1,1"
                                    CornerRadius="2" />
                        </Border>
                        <Border x:Name="NormalElement"
                                Background="{StaticResource ControlBackgroundNormalGreen}"
                                CornerRadius="2"
                                Effect="{StaticResource ControlShadowEffect}" />
                        <Border x:Name="MouseOverElement"
                                Background="{StaticResource ControlBackgroundOverGreen}"
                                CornerRadius="2"
                                Opacity="0" />
                        <Border x:Name="PressedElement"
                                Background="{StaticResource ControlBackgroundPressedGreen}"
                                CornerRadius="2"
                                Opacity="0" />
                        <Border x:Name="HighlightElement"
                                BorderBrush="{StaticResource HighlightBrushGreen}"
                                BorderThickness="0.5,1,0,0"
                                CornerRadius="2" />
                        <ContentPresenter x:Name="ContentHost"
                                          Margin="{TemplateBinding Padding}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <ContentPresenter.Effect>
                                <DropShadowEffect BlurRadius="1"
                                                  Direction="90"
                                                  Opacity="0.5"
                                                  ShadowDepth="1"
                                                  Color="{StaticResource ColorForegroundShadowColorGreen}" />
                            </ContentPresenter.Effect>
                        </ContentPresenter>
                        <Rectangle x:Name="FocusVisualElement"
                                   Margin="1"
                                   IsHitTestVisible="False"
                                   Opacity="0"
                                   RadiusX="1"
                                   RadiusY="1"
                                   Stroke="{StaticResource FocusVisualBrush}"
                                   StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        OrangeButton
        ***************************************************************************
    -->

    <Style x:Key="OrangeButton" TargetType="Button">
        <Setter Property="Padding" Value="18,6" />
        <Setter Property="TextOptions.TextHintingMode" Value="Fixed" />
        <Setter Property="Foreground" Value="{StaticResource ControlForegroundOrange}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid x:Name="Root">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.1" />
                                    <VisualTransition To="Pressed" />
                                    <VisualTransition From="Pressed" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="PressedElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="MouseOverElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="NormalElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0.25" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="PressedElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="MouseOverElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="HighlightElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0.5" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="NormalElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="DisabledElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="HighlightElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0.5" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="ContentHost"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0.65" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="FocusVisualElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="DisabledElement"
                                Background="{StaticResource DisabledBrush}"
                                CornerRadius="2"
                                Opacity="0">
                            <Border BorderBrush="{StaticResource DisabledBorderBrush}"
                                    BorderThickness="0,0,1,1"
                                    CornerRadius="2" />
                        </Border>
                        <Border x:Name="NormalElement"
                                Background="{StaticResource ControlBackgroundNormalOrange}"
                                CornerRadius="2"
                                Effect="{StaticResource ControlShadowEffect}" />
                        <Border x:Name="MouseOverElement"
                                Background="{StaticResource ControlBackgroundOverOrange}"
                                CornerRadius="2"
                                Opacity="0" />
                        <Border x:Name="PressedElement"
                                Background="{StaticResource ControlBackgroundPressedOrange}"
                                CornerRadius="2"
                                Opacity="0" />
                        <Border x:Name="HighlightElement"
                                BorderBrush="{StaticResource HighlightBrushOrange}"
                                BorderThickness="0.5,1,0,0"
                                CornerRadius="2" />
                        <ContentPresenter x:Name="ContentHost"
                                          Margin="{TemplateBinding Padding}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <ContentPresenter.Effect>
                                <DropShadowEffect BlurRadius="1"
                                                  Direction="90"
                                                  Opacity="0.5"
                                                  ShadowDepth="1"
                                                  Color="{StaticResource ColorForegroundShadowColorOrange}" />
                            </ContentPresenter.Effect>
                        </ContentPresenter>
                        <Rectangle x:Name="FocusVisualElement"
                                   Margin="1"
                                   IsHitTestVisible="False"
                                   Opacity="0"
                                   RadiusX="1"
                                   RadiusY="1"
                                   Stroke="{StaticResource FocusVisualBrush}"
                                   StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        BlueButton
        ***************************************************************************
    -->

    <Style x:Key="BlueButton" TargetType="Button">
        <Setter Property="Padding" Value="18,6" />
        <Setter Property="TextOptions.TextHintingMode" Value="Fixed" />
        <Setter Property="Foreground" Value="{StaticResource ControlForegroundBlue}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid x:Name="Root">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.1" />
                                    <VisualTransition To="Pressed" />
                                    <VisualTransition From="Pressed" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="PressedElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="MouseOverElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="NormalElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0.25" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="PressedElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="MouseOverElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="HighlightElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0.5" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="NormalElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="DisabledElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="HighlightElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0.5" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="ContentHost"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0.65" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="FocusVisualElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="DisabledElement"
                                Background="{StaticResource DisabledBrush}"
                                CornerRadius="2"
                                Opacity="0">
                            <Border BorderBrush="{StaticResource DisabledBorderBrush}"
                                    BorderThickness="0,0,1,1"
                                    CornerRadius="2" />
                        </Border>
                        <Border x:Name="NormalElement"
                                Background="{StaticResource ControlBackgroundNormalBlue}"
                                CornerRadius="2"
                                Effect="{StaticResource ControlShadowEffect}" />
                        <Border x:Name="MouseOverElement"
                                Background="{StaticResource ControlBackgroundOverBlue}"
                                CornerRadius="2"
                                Opacity="0" />
                        <Border x:Name="PressedElement"
                                Background="{StaticResource ControlBackgroundPressedBlue}"
                                CornerRadius="2"
                                Opacity="0" />
                        <Border x:Name="HighlightElement"
                                BorderBrush="{StaticResource HighlightBrushBlue}"
                                BorderThickness="0.5,1,0,0"
                                CornerRadius="2" />
                        <ContentPresenter x:Name="ContentHost"
                                          Margin="{TemplateBinding Padding}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <ContentPresenter.Effect>
                                <DropShadowEffect BlurRadius="1"
                                                  Direction="90"
                                                  Opacity="0.5"
                                                  ShadowDepth="1"
                                                  Color="{StaticResource ColorForegroundShadowColorBlue}" />
                            </ContentPresenter.Effect>
                        </ContentPresenter>
                        <Rectangle x:Name="FocusVisualElement"
                                   Margin="1"
                                   IsHitTestVisible="False"
                                   Opacity="0"
                                   RadiusX="1"
                                   RadiusY="1"
                                   Stroke="{StaticResource FocusVisualBrush}"
                                   StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        RepeatButton
        ***************************************************************************
    -->

    <Style TargetType="RepeatButton">
        <Setter Property="Padding" Value="18,6" />
        <Setter Property="TextOptions.TextHintingMode" Value="Animated" />
        <Setter Property="Foreground" Value="{StaticResource ControlForeground}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="RepeatButton">
                    <Grid x:Name="Root">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.1" />
                                    <VisualTransition To="Pressed" />
                                    <VisualTransition From="Pressed" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="PressedElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="MouseOverElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="NormalElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0.25" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="PressedElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="MouseOverElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="NormalElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="DisabledElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="HighlightElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0.5" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="ContentHost"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0.75" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="FocusVisualElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="DisabledElement"
                                Background="{StaticResource DisabledBrush}"
                                CornerRadius="2"
                                Opacity="0">
                            <Border BorderBrush="{StaticResource DisabledBorderBrush}"
                                    BorderThickness="0,0,1,1"
                                    CornerRadius="2" />
                        </Border>
                        <Border x:Name="NormalElement"
                                Background="{StaticResource ControlBackgroundNormal}"
                                CornerRadius="2"
                                Effect="{StaticResource ControlShadowEffect}" />
                        <Border x:Name="MouseOverElement"
                                Background="{StaticResource ControlBackgroundOver}"
                                CornerRadius="2"
                                Opacity="0" />
                        <Border x:Name="PressedElement"
                                Background="{StaticResource ControlBackgroundPressed}"
                                CornerRadius="2"
                                Opacity="0" />
                        <Border x:Name="HighlightElement"
                                BorderBrush="{StaticResource ControlHighlight}"
                                BorderThickness="1,1,0,0"
                                CornerRadius="2" />
                        <ContentPresenter x:Name="ContentHost"
                                          Margin="{TemplateBinding Padding}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <ContentPresenter.Effect>
                                <DropShadowEffect BlurRadius="1"
                                                  Direction="-90"
                                                  Opacity="0.5"
                                                  ShadowDepth="1"
                                                  Color="{StaticResource ColorForegroundShadowColor}" />
                            </ContentPresenter.Effect>
                        </ContentPresenter>
                        <Rectangle x:Name="FocusVisualElement"
                                   Margin="1"
                                   IsHitTestVisible="False"
                                   Opacity="0"
                                   RadiusX="1"
                                   RadiusY="1"
                                   Stroke="{StaticResource FocusVisualBrush}"
                                   StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        ToggleButton
        ***************************************************************************
    -->

    <Style TargetType="ToggleButton">
        <Setter Property="Padding" Value="18,6" />
        <Setter Property="TextOptions.TextHintingMode" Value="Animated" />
        <Setter Property="Foreground" Value="{StaticResource ControlForeground}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ToggleButton">
                    <Grid x:Name="Root">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.1" />
                                    <VisualTransition To="Pressed" />
                                    <VisualTransition From="Pressed" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="MouseOverElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="NormalElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="DisabledElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="HighlightElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0.5" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="ContentHost"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0.75" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CheckStates">
                                <VisualState x:Name="Checked">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="NormalElement"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="0" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="HighlightElement"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="0" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="CheckedElement"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="1" />
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="MouseOverElement" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unchecked" />
                                <VisualState x:Name="Indeterminate" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="FocusVisualElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="DisabledElement"
                                Background="{StaticResource DisabledBrush}"
                                CornerRadius="2"
                                Opacity="0">
                            <Border BorderBrush="{StaticResource DisabledBorderBrush}"
                                    BorderThickness="0,0,1,1"
                                    CornerRadius="2" />
                        </Border>
                        <Border x:Name="NormalElement"
                                Background="{StaticResource ControlBackgroundNormal}"
                                CornerRadius="2"
                                Effect="{StaticResource ControlShadowEffect}" />
                        <Border x:Name="CheckedElement"
                                Margin="0,-1,0,-1"
                                BorderBrush="#D0494a4d"
                                BorderThickness="1"
                                CornerRadius="2.5"
                                Opacity="0">
                            <Border.Background>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                    <GradientStop Offset="0.1" Color="#FFE6E6E6" />
                                    <GradientStop Offset="0.9" Color="#FFC9C9C9" />
                                </LinearGradientBrush>
                            </Border.Background>
                            <Border BorderBrush="#70303030"
                                    BorderThickness="1,1,0,0"
                                    CornerRadius="2">
                                <Border BorderBrush="#30303030"
                                        BorderThickness="1"
                                        CornerRadius="1.5">
                                    <Border BorderBrush="#10303030"
                                            BorderThickness="1,1,0,0"
                                            CornerRadius="1" />
                                </Border>
                            </Border>
                        </Border>
                        <Border x:Name="MouseOverElement"
                                Background="{StaticResource ControlBackgroundOver}"
                                CornerRadius="2"
                                Opacity="0" />
                        <Border x:Name="HighlightElement"
                                BorderBrush="{StaticResource ControlHighlight}"
                                BorderThickness="1,1,0,0"
                                CornerRadius="2" />
                        <ContentPresenter x:Name="ContentHost"
                                          Margin="{TemplateBinding Padding}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <ContentPresenter.Effect>
                                <DropShadowEffect BlurRadius="1"
                                                  Direction="-90"
                                                  Opacity="0.5"
                                                  ShadowDepth="1"
                                                  Color="{StaticResource ColorForegroundShadowColor}" />
                            </ContentPresenter.Effect>
                        </ContentPresenter>
                        <Rectangle x:Name="FocusVisualElement"
                                   Margin="1"
                                   IsHitTestVisible="False"
                                   Opacity="0"
                                   RadiusX="1"
                                   RadiusY="1"
                                   Stroke="{StaticResource FocusVisualBrush}"
                                   StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        ToolTip
        ***************************************************************************
    -->

    <!--  TODO  -->
    <Style TargetType="ToolTip">
        <Setter Property="Background" Value="{StaticResource ControlBackgroundNormalGreen}" />
        <Setter Property="FontFamily" Value="{StaticResource ContentFontFamily}" />
        <Setter Property="FontSize" Value="{StaticResource NormalFontSize}" />
        <Setter Property="Foreground" Value="{StaticResource InputSelectionForegroundBrush}" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="Padding" Value="6" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="Effect">
            <Setter.Value>
                <DropShadowEffect BlurRadius="2"
                                  Direction="293"
                                  Opacity="0.24"
                                  ShadowDepth="1" />
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ToolTip">
                    <Grid x:Name="LayoutRoot">
                        <Border x:Name="Background"
                                Background="{TemplateBinding Background}"
                                CornerRadius="3">
                            <Border.Effect>
                                <DropShadowEffect BlurRadius="3"
                                                  Direction="0"
                                                  Opacity="0.1"
                                                  ShadowDepth="0" />
                            </Border.Effect>
                        </Border>
                        <Border x:Name="TopBorder"
                                BorderBrush="{StaticResource HighlightBrushGreen}"
                                BorderThickness="0,1,0,0"
                                CornerRadius="3" />
                        <Border x:Name="LeftBorder"
                                BorderThickness="1,0,0,0"
                                CornerRadius="3">
                            <Border.BorderBrush>
                                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                    <GradientStop Offset="0" Color="#FFBAD700" />
                                    <GradientStop Offset="1" Color="#FF94AD00" />
                                </LinearGradientBrush>
                            </Border.BorderBrush>
                        </Border>
                        <Border x:Name="Gradient"
                                Margin="1,1,0,0"
                                Background="{StaticResource OverlayBrush}"
                                CornerRadius="2" />
                        <ContentPresenter x:Name="contentPresenter"
                                          Margin="{TemplateBinding Padding}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                          Content="{TemplateBinding Content}"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          Effect="{StaticResource TextEffect}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--  Validation ToolTip Template.  -->
    <ControlTemplate x:Key="ValidationToolTipTemplate">
        <Grid x:Name="Root"
              Margin="5,0"
              Opacity="0"
              RenderTransformOrigin="0,0">
            <Grid.RenderTransform>
                <TranslateTransform x:Name="xform" X="-25" />
            </Grid.RenderTransform>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="OpenStates">
                    <VisualStateGroup.Transitions>
                        <VisualTransition GeneratedDuration="0" />
                        <VisualTransition GeneratedDuration="0:0:0.2" To="Open">
                            <Storyboard>
                                <DoubleAnimation Duration="0:0:0.2"
                                                 Storyboard.TargetName="xform"
                                                 Storyboard.TargetProperty="X"
                                                 To="0">
                                    <DoubleAnimation.EasingFunction>
                                        <BackEase Amplitude=".3" EasingMode="EaseOut" />
                                    </DoubleAnimation.EasingFunction>
                                </DoubleAnimation>
                                <DoubleAnimation Duration="0:0:0.2"
                                                 Storyboard.TargetName="Root"
                                                 Storyboard.TargetProperty="Opacity"
                                                 To="1" />
                            </Storyboard>
                        </VisualTransition>
                    </VisualStateGroup.Transitions>
                    <VisualState x:Name="Closed">
                        <Storyboard>
                            <DoubleAnimation Duration="0"
                                             Storyboard.TargetName="Root"
                                             Storyboard.TargetProperty="Opacity"
                                             To="0" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Open">
                        <Storyboard>
                            <DoubleAnimation Duration="0"
                                             Storyboard.TargetName="xform"
                                             Storyboard.TargetProperty="X"
                                             To="0" />
                            <DoubleAnimation Duration="0"
                                             Storyboard.TargetName="Root"
                                             Storyboard.TargetProperty="Opacity"
                                             To="1" />
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border Margin="4,4,-4,-4"
                    Background="#052A2E31"
                    CornerRadius="5" />
            <Border Margin="3,3,-3,-3"
                    Background="#152A2E31"
                    CornerRadius="4" />
            <Border Margin="2,2,-2,-2"
                    Background="#252A2E31"
                    CornerRadius="3" />
            <Border Margin="1,1,-1,-1"
                    Background="#352A2E31"
                    CornerRadius="2" />
            <Border Background="#FFDC000C" CornerRadius="2" />
            <Border CornerRadius="2">
                <TextBlock MaxWidth="250"
                           Margin="8,4,8,4"
                           Foreground="White"
                           Text="{Binding (Validation.Errors)[0].ErrorContent}"
                           TextWrapping="Wrap"
                           UseLayoutRounding="false" />
            </Border>
        </Grid>
    </ControlTemplate>

    <!--
        ***************************************************************************
        TextBox
        ***************************************************************************
    -->

    <Style TargetType="TextBox">
        <Setter Property="Background" Value="{StaticResource InputBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Foreground" Value="{StaticResource InputForegroundBrush}" />
        <Setter Property="Padding" Value="5,4,5,4" />
        <Setter Property="SelectionBackground" Value="{StaticResource InputSelectionBrush}" />
        <Setter Property="SelectionForeground" Value="{StaticResource InputSelectionForegroundBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="TextBox">
                    <Grid x:Name="RootElement">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="DisabledVisualElement"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0.55" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="ContentElement"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="0.5" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="ReadOnly">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="ReadOnlyVisualElement"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0.55" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="FocusVisualElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid" />
                                <VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsOpen">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <System:Boolean>True</System:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Border"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="2.5"
                                Opacity="1">
                            <Grid>
                                <Border x:Name="ReadOnlyVisualElement"
                                        Background="{StaticResource ReadOnlyBrush}"
                                        CornerRadius="2"
                                        Opacity="0" />
                                <ScrollViewer x:Name="ContentElement"
                                              Margin="1"
                                              BorderThickness="0"
                                              IsTabStop="False"
                                              Padding="{TemplateBinding Padding}" />
                            </Grid>
                        </Border>
                        <Border x:Name="OuterHighlight"
                                Margin="0,0,-1,-1"
                                BorderBrush="{StaticResource ControlOuterHighlightBrush}"
                                BorderThickness="0,0,1,1"
                                CornerRadius="3" />
                        <Border x:Name="InnerShadowDark"
                                Margin="1"
                                BorderBrush="{StaticResource InnerShadowDarkBrush}"
                                BorderThickness="1,1,0,0"
                                CornerRadius="2" />
                        <Border x:Name="InnerShadowLight"
                                Margin="2"
                                BorderBrush="{StaticResource InnerShadowLightBrush}"
                                BorderThickness="1,1,0,0"
                                CornerRadius="1" />
                        <Border x:Name="DisabledVisualElement"
                                Margin="1"
                                Background="{StaticResource DisabledBrush}"
                                CornerRadius="2"
                                IsHitTestVisible="False"
                                Opacity="0" />
                        <Rectangle x:Name="FocusVisualElement"
                                   Margin="2"
                                   IsHitTestVisible="False"
                                   Opacity="0"
                                   RadiusX="1"
                                   RadiusY="1"
                                   Stroke="{StaticResource FocusVisualBrush}"
                                   StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                        <Border x:Name="ValidationErrorElement"
                                BorderBrush="{StaticResource ErrorBrush}"
                                BorderThickness="1"
                                CornerRadius="3"
                                Visibility="Collapsed">
                            <ToolTipService.ToolTip>
                                <ToolTip x:Name="validationTooltip"
                                         DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                         Placement="Right"
                                         PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                         Template="{StaticResource ValidationToolTipTemplate}">
                                    <ToolTip.Triggers>
                                        <EventTrigger RoutedEvent="Canvas.Loaded">
                                            <BeginStoryboard>
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsHitTestVisible">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="True" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </EventTrigger>
                                    </ToolTip.Triggers>
                                </ToolTip>
                            </ToolTipService.ToolTip>
                            <Grid Width="12"
                                  Height="12"
                                  Margin="1,-4,-4,0"
                                  HorizontalAlignment="Right"
                                  VerticalAlignment="Top"
                                  Background="Transparent">
                                <Path Margin="1,3,0,0"
                                      Data="M 1,0 L6,0 A 2,2 90 0 1 8,2 L8,7 z"
                                      Fill="{StaticResource ErrorBrush}" />
                            </Grid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="controls:TextBoxExt">
        <Setter Property="Background" Value="{StaticResource InputBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Foreground" Value="{StaticResource InputForegroundBrush}" />
        <Setter Property="Padding" Value="5,4,5,4" />
        <Setter Property="SelectionBackground" Value="{StaticResource InputSelectionBrush}" />
        <Setter Property="SelectionForeground" Value="{StaticResource InputSelectionForegroundBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:TextBoxExt">
                    <Grid x:Name="RootElement">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="DisabledVisualElement"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0.55" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="ContentElement"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="0.5" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="ReadOnly">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="ReadOnlyVisualElement"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0.55" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="FocusVisualElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid" />
                                <VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsOpen">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <System:Boolean>True</System:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Border"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="2.5"
                                Opacity="1">
                            <Grid>
                                <Border x:Name="ReadOnlyVisualElement"
                                        Background="{StaticResource ReadOnlyBrush}"
                                        CornerRadius="2"
                                        Opacity="0" />
                                <TextBlock Margin="5,0"
                                           VerticalAlignment="Center"
                                           Foreground="{StaticResource COLOR_LIGHTGRAY}"
                                           Text="{TemplateBinding PlaceText}"
                                           Visibility="{Binding Text.Length,
                                                                Converter={StaticResource EuqalsToVisibilityConverter},
                                                                RelativeSource={RelativeSource TemplatedParent},
                                                                ConverterParameter=0}" />
                                <ScrollViewer x:Name="ContentElement"
                                              Margin="1"
                                              BorderThickness="0"
                                              IsTabStop="False"
                                              Padding="{TemplateBinding Padding}" />
                            </Grid>
                        </Border>
                        <Border x:Name="OuterHighlight"
                                Margin="0,0,-1,-1"
                                BorderBrush="{StaticResource ControlOuterHighlightBrush}"
                                BorderThickness="0,0,1,1"
                                CornerRadius="3" />
                        <Border x:Name="InnerShadowDark"
                                Margin="1"
                                BorderBrush="{StaticResource InnerShadowDarkBrush}"
                                BorderThickness="1,1,0,0"
                                CornerRadius="2" />
                        <Border x:Name="InnerShadowLight"
                                Margin="2"
                                BorderBrush="{StaticResource InnerShadowLightBrush}"
                                BorderThickness="1,1,0,0"
                                CornerRadius="1" />
                        <Border x:Name="DisabledVisualElement"
                                Margin="1"
                                Background="{StaticResource DisabledBrush}"
                                CornerRadius="2"
                                IsHitTestVisible="False"
                                Opacity="0" />
                        <Rectangle x:Name="FocusVisualElement"
                                   Margin="2"
                                   IsHitTestVisible="False"
                                   Opacity="0"
                                   RadiusX="1"
                                   RadiusY="1"
                                   Stroke="{StaticResource FocusVisualBrush}"
                                   StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                        <Border x:Name="ValidationErrorElement"
                                BorderBrush="{StaticResource ErrorBrush}"
                                BorderThickness="1"
                                CornerRadius="3"
                                Visibility="Collapsed">
                            <ToolTipService.ToolTip>
                                <ToolTip x:Name="validationTooltip"
                                         DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                         Placement="Right"
                                         PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                         Template="{StaticResource ValidationToolTipTemplate}">
                                    <ToolTip.Triggers>
                                        <EventTrigger RoutedEvent="Canvas.Loaded">
                                            <BeginStoryboard>
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsHitTestVisible">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="True" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </EventTrigger>
                                    </ToolTip.Triggers>
                                </ToolTip>
                            </ToolTipService.ToolTip>
                            <Grid Width="12"
                                  Height="12"
                                  Margin="1,-4,-4,0"
                                  HorizontalAlignment="Right"
                                  VerticalAlignment="Top"
                                  Background="Transparent">
                                <Path Margin="1,3,0,0"
                                      Data="M 1,0 L6,0 A 2,2 90 0 1 8,2 L8,7 z"
                                      Fill="{StaticResource ErrorBrush}" />
                            </Grid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        PasswordBox
        ***************************************************************************
    -->

    <Style TargetType="PasswordBox">
        <Setter Property="Background" Value="{StaticResource InputBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Foreground" Value="{StaticResource InputForegroundBrush}" />
        <Setter Property="Padding" Value="5,4,5,4" />
        <Setter Property="SelectionBackground" Value="{StaticResource InputSelectionBrush}" />
        <Setter Property="SelectionForeground" Value="{StaticResource InputSelectionForegroundBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="PasswordBox">
                    <Grid x:Name="RootElement">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="DisabledVisualElement"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0.55" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="ContentElement"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="0.5" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="ReadOnly">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="ReadOnlyVisualElement"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0.55" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="FocusVisualElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid" />
                                <VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsOpen">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <System:Boolean>True</System:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Border"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="2.5"
                                Opacity="1">
                            <Grid>
                                <Border x:Name="ReadOnlyVisualElement"
                                        Background="{StaticResource ReadOnlyBrush}"
                                        CornerRadius="2"
                                        Opacity="0" />
                                <Border x:Name="ContentElement"
                                        Margin="1"
                                        BorderThickness="0"
                                        Padding="{TemplateBinding Padding}" />
                            </Grid>
                        </Border>
                        <Border x:Name="OuterHighlight"
                                Margin="0,0,-1,-1"
                                BorderBrush="{StaticResource ControlOuterHighlightBrush}"
                                BorderThickness="0,0,1,1"
                                CornerRadius="3" />
                        <Border x:Name="InnerShadowDark"
                                Margin="1"
                                BorderBrush="{StaticResource InnerShadowDarkBrush}"
                                BorderThickness="1,1,0,0"
                                CornerRadius="2" />
                        <Border x:Name="InnerShadowLight"
                                Margin="2"
                                BorderBrush="{StaticResource InnerShadowLightBrush}"
                                BorderThickness="1,1,0,0"
                                CornerRadius="1" />
                        <Border x:Name="DisabledVisualElement"
                                Margin="1"
                                Background="{StaticResource DisabledBrush}"
                                CornerRadius="2"
                                IsHitTestVisible="False"
                                Opacity="0" />
                        <Rectangle x:Name="FocusVisualElement"
                                   Margin="2"
                                   IsHitTestVisible="False"
                                   Opacity="0"
                                   RadiusX="1"
                                   RadiusY="1"
                                   Stroke="{StaticResource FocusVisualBrush}"
                                   StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                        <Border x:Name="ValidationErrorElement"
                                BorderBrush="{StaticResource ErrorBrush}"
                                BorderThickness="1"
                                CornerRadius="3"
                                Visibility="Collapsed">
                            <ToolTipService.ToolTip>
                                <ToolTip x:Name="validationTooltip"
                                         DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                         Placement="Right"
                                         PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                         Template="{StaticResource ValidationToolTipTemplate}">
                                    <ToolTip.Triggers>
                                        <EventTrigger RoutedEvent="Canvas.Loaded">
                                            <BeginStoryboard>
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsHitTestVisible">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="True" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </EventTrigger>
                                    </ToolTip.Triggers>
                                </ToolTip>
                            </ToolTipService.ToolTip>
                            <Grid Width="12"
                                  Height="12"
                                  Margin="1,-4,-4,0"
                                  HorizontalAlignment="Right"
                                  VerticalAlignment="Top"
                                  Background="Transparent">
                                <Path Margin="1,3,0,0"
                                      Data="M 1,0 L6,0 A 2,2 90 0 1 8,2 L8,7 z"
                                      Fill="{StaticResource ErrorBrush}" />
                            </Grid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <!--
        ***************************************************************************
        CheckBox
        ***************************************************************************
    -->

    <Style TargetType="CheckBox">
        <Setter Property="Background" Value="{StaticResource CheckBoxBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource CheckBoxBorderBrush}" />
        <Setter Property="Foreground" Value="{StaticResource NormalFontBrush}" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="Padding" Value="6,1,0,0" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="CheckBox">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="13" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="MouseOverBorder" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PressedBorder" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="contentPresenter"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To=".55" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="DisabledVisualElement"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="0.55" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CheckStates">
                                <VisualState x:Name="Checked">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="CheckIcon"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unchecked" />
                                <VisualState x:Name="Indeterminate">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="IndeterminateIcon"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="FocusVisualElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid" />
                                <VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsOpen">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <System:Boolean>True</System:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid Width="12"
                              Height="12"
                              HorizontalAlignment="Left"
                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <Rectangle x:Name="Background"
                                       Width="12"
                                       Height="12"
                                       Fill="{TemplateBinding Background}"
                                       Stroke="{TemplateBinding BorderBrush}" />
                            <Border x:Name="OuterHighlight"
                                    Margin="1,1,-1,-1"
                                    BorderBrush="{StaticResource ControlOuterHighlightBrush}"
                                    BorderThickness="0,0,1,1"
                                    CornerRadius="1,0,1,0" />
                            <Border x:Name="InnerShadow"
                                    Margin="1,1,0,0"
                                    BorderBrush="{StaticResource CheckBoxInnerShadowBrush}"
                                    BorderThickness="1,1,0,0"
                                    CornerRadius="0.5" />
                            <Border x:Name="MouseOverBorder"
                                    Margin="1"
                                    BorderBrush="{StaticResource ColorAccentBrush}"
                                    BorderThickness="1"
                                    Visibility="Collapsed" />
                            <Border x:Name="PressedBorder"
                                    Margin="1"
                                    BorderBrush="{StaticResource ColorAccentSubduedBrush}"
                                    BorderThickness="1"
                                    Visibility="Collapsed" />
                            <Path x:Name="CheckIcon"
                                  Margin="2,2,0,1"
                                  Data="M0.5625,5.0625 L1.5,3.9375 L2.9575791,4.9549685 C2.9575791,4.9549685 5.75,1.125 5.75,1.125 C5.75,1.125 6.9375,2 6.9375,2 C6.9375,2 3.186887,7.0000076 3.186887,7.0000076 z"
                                  Fill="{StaticResource ColorAccentHighlightBrush}"
                                  FlowDirection="LeftToRight"
                                  Opacity="0" />
                            <Rectangle x:Name="IndeterminateIcon"
                                       Width="6"
                                       Height="2"
                                       Fill="{StaticResource ColorAccentHighlightBrush}"
                                       Opacity="0" />
                            <Rectangle x:Name="DisabledVisualElement"
                                       Width="12"
                                       Height="12"
                                       Fill="{StaticResource DisabledBrush}"
                                       Opacity="0" />
                            <Rectangle x:Name="FocusVisualElement"
                                       Margin="2"
                                       IsHitTestVisible="False"
                                       Opacity="0"
                                       Stroke="{StaticResource FocusVisualBrush}"
                                       StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                            <Border x:Name="ValidationErrorElement"
                                    Margin="1"
                                    BorderBrush="{StaticResource ErrorBrush}"
                                    BorderThickness="1"
                                    ToolTipService.PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                    Visibility="Collapsed">
                                <ToolTipService.ToolTip>
                                    <ToolTip x:Name="validationTooltip"
                                             DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                             Placement="Right"
                                             PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                             Template="{StaticResource ValidationToolTipTemplate}">
                                        <ToolTip.Triggers>
                                            <EventTrigger RoutedEvent="Canvas.Loaded">
                                                <BeginStoryboard>
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsHitTestVisible">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <System:Boolean>true</System:Boolean>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </BeginStoryboard>
                                            </EventTrigger>
                                        </ToolTip.Triggers>
                                    </ToolTip>
                                </ToolTipService.ToolTip>
                                <Grid Width="10"
                                      Height="10"
                                      Margin="0,-4,-4,0"
                                      HorizontalAlignment="Right"
                                      VerticalAlignment="Top"
                                      Background="Transparent">
                                    <Path Margin="0,3,0,0"
                                          Data="M 1,0 L5,0 A 2,2 90 0 1 7,2 L7,6 z"
                                          Fill="{StaticResource ErrorBrush}" />
                                </Grid>
                            </Border>
                        </Grid>
                        <ContentPresenter x:Name="contentPresenter"
                                          Grid.Column="1"
                                          Margin="{TemplateBinding Padding}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                          Content="{TemplateBinding Content}"
                                          ContentTemplate="{TemplateBinding ContentTemplate}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        RadioButton
        ***************************************************************************
    -->

    <Style TargetType="RadioButton">
        <Setter Property="Background" Value="{StaticResource RadioButtonBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource RadioButtonBorderBrush}" />
        <Setter Property="Foreground" Value="{StaticResource NormalFontBrush}" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="Padding" Value="6,1,0,0" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="RadioButton">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="13" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="MouseOverBorder" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PressedBorder" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="contentPresenter"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To=".55" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="DisabledVisualElement"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="0.55" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CheckStates">
                                <VisualState x:Name="Checked">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="CheckIcon"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unchecked" />
                                <VisualState x:Name="Indeterminate">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="IndeterminateIcon"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="FocusVisualElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid" />
                                <VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsOpen">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <System:Boolean>True</System:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid Width="12"
                              Height="12"
                              HorizontalAlignment="Left"
                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <Ellipse x:Name="OuterHighlight"
                                     Margin="1,1,-0.5,-0.5"
                                     Stroke="#90FFFFFF"
                                     StrokeThickness="1" />
                            <Ellipse x:Name="Background"
                                     Width="12"
                                     Height="12"
                                     Fill="{TemplateBinding Background}"
                                     Stroke="{TemplateBinding BorderBrush}"
                                     StrokeThickness="{TemplateBinding BorderThickness}" />
                            <Ellipse Margin="1" Fill="{StaticResource RadioButtonInnerShadowBrush}" />
                            <Border x:Name="MouseOverBorder"
                                    Margin="1"
                                    BorderBrush="{StaticResource ColorAccentBrush}"
                                    BorderThickness="1"
                                    CornerRadius="6"
                                    Visibility="Collapsed" />
                            <Border x:Name="PressedBorder"
                                    Margin="1"
                                    BorderBrush="{StaticResource ColorAccentSubduedBrush}"
                                    BorderThickness="1"
                                    CornerRadius="6"
                                    Visibility="Collapsed" />
                            <Ellipse x:Name="CheckIcon"
                                     Margin="3"
                                     Fill="{StaticResource ColorAccentHighlightBrush}"
                                     Opacity="0" />
                            <Ellipse x:Name="IndeterminateIcon"
                                     Margin="3"
                                     Opacity="0"
                                     Stroke="{StaticResource ColorAccentHighlightBrush}"
                                     StrokeThickness="1" />
                            <Ellipse x:Name="DisabledVisualElement"
                                     Width="12"
                                     Height="12"
                                     Fill="{StaticResource DisabledBrush}"
                                     Opacity="0" />
                            <Ellipse x:Name="FocusVisualElement"
                                     Margin="2"
                                     IsHitTestVisible="False"
                                     Opacity="0"
                                     Stroke="{StaticResource FocusVisualBrush}"
                                     StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                            <Grid x:Name="ValidationErrorElement"
                                  ToolTipService.PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                  Visibility="Collapsed">
                                <ToolTipService.ToolTip>
                                    <ToolTip x:Name="validationTooltip"
                                             DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                             Placement="Right"
                                             PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                             Template="{StaticResource ValidationToolTipTemplate}">
                                        <ToolTip.Triggers>
                                            <EventTrigger RoutedEvent="Canvas.Loaded">
                                                <BeginStoryboard>
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsHitTestVisible">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <System:Boolean>true</System:Boolean>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </BeginStoryboard>
                                            </EventTrigger>
                                        </ToolTip.Triggers>
                                    </ToolTip>
                                </ToolTipService.ToolTip>
                                <Ellipse Width="12"
                                         Height="12"
                                         Stroke="{StaticResource ErrorBrush}"
                                         StrokeThickness="1" />
                                <Ellipse Width="4"
                                         Height="4"
                                         Margin="0,-3,-3,0"
                                         HorizontalAlignment="Right"
                                         VerticalAlignment="Top"
                                         Fill="{StaticResource ErrorBrush}" />
                                <Ellipse Width="10"
                                         Height="10"
                                         Margin="0,-6,-5,0"
                                         HorizontalAlignment="Right"
                                         VerticalAlignment="Top"
                                         Fill="Transparent" />
                            </Grid>
                        </Grid>
                        <ContentPresenter x:Name="contentPresenter"
                                          Grid.Column="1"
                                          Margin="{TemplateBinding Padding}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                          Content="{TemplateBinding Content}"
                                          ContentTemplate="{TemplateBinding ContentTemplate}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--  Text Styles.  -->
    <Style TargetType="TextBlock">
        <Setter Property="Foreground" Value="{StaticResource NormalFontBrush}" />
    </Style>

    <Style x:Key="HeadingBase" TargetType="TextBlock">
        <Setter Property="FontFamily" Value="{StaticResource HeadingFontFamily}" />
        <Setter Property="FontWeight" Value="Bold" />
        <Setter Property="Foreground" Value="{StaticResource NormalFontBrush}" />
    </Style>
    <Style x:Key="Heading1"
           BasedOn="{StaticResource HeadingBase}"
           TargetType="TextBlock">
        <Setter Property="FontSize" Value="{StaticResource Heading1FontSize}" />
        <Setter Property="Foreground" Value="{StaticResource Heading1FontBrush}" />
    </Style>
    <Style x:Key="Heading2"
           BasedOn="{StaticResource HeadingBase}"
           TargetType="TextBlock">
        <Setter Property="FontSize" Value="{StaticResource Heading2FontSize}" />
        <Setter Property="Foreground" Value="{StaticResource Heading2FontBrush}" />
    </Style>
    <Style x:Key="Heading3"
           BasedOn="{StaticResource HeadingBase}"
           TargetType="TextBlock">
        <Setter Property="FontSize" Value="{StaticResource Heading3FontSize}" />
        <Setter Property="Foreground" Value="{StaticResource Heading3FontBrush}" />
    </Style>
    <Style x:Key="Heading4"
           BasedOn="{StaticResource HeadingBase}"
           TargetType="TextBlock">
        <Setter Property="FontSize" Value="{StaticResource Heading4FontSize}" />
    </Style>
    <Style x:Key="Heading5"
           BasedOn="{StaticResource HeadingBase}"
           TargetType="TextBlock">
        <Setter Property="FontSize" Value="{StaticResource Heading5FontSize}" />
    </Style>
    <Style x:Key="Heading6"
           BasedOn="{StaticResource HeadingBase}"
           TargetType="TextBlock">
        <Setter Property="FontSize" Value="{StaticResource Heading6FontSize}" />
    </Style>

    <!--
        ***************************************************************************
        HyperlinkButton
        ***************************************************************************
    -->

    <Style TargetType="HyperlinkButton">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="Foreground" Value="{StaticResource ColorAccentHighlightBrush}" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="Padding" Value="2,0,2,0" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="HyperlinkButton">
                    <Grid Background="{TemplateBinding Background}" Cursor="{TemplateBinding Cursor}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="Underline"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="1.0" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ColorAnimation Duration="0"
                                                        Storyboard.TargetName="contentPresenter"
                                                        Storyboard.TargetProperty="(Control.Foreground).(SolidColorBrush.Color)"
                                                        To="#FFA0A0A0"
                                                        d:IsOptimized="True" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="FocusVisualElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <StackPanel Margin="{TemplateBinding Padding}"
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                    UseLayoutRounding="True">
                            <ContentControl x:Name="contentPresenter"
                                            Content="{TemplateBinding Content}"
                                            ContentTemplate="{TemplateBinding ContentTemplate}"
                                            Foreground="{TemplateBinding Foreground}" />
                            <Rectangle x:Name="Underline"
                                       Height="1"
                                       Margin="0,1,0,2"
                                       VerticalAlignment="Bottom"
                                       Fill="{TemplateBinding Foreground}"
                                       Opacity="0" />
                        </StackPanel>
                        <Rectangle x:Name="FocusVisualElement"
                                   Margin="0"
                                   IsHitTestVisible="False"
                                   Opacity="0"
                                   RadiusX="2"
                                   RadiusY="2"
                                   Stroke="{StaticResource FocusVisualBrush}"
                                   StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        ProgressBar (control template separate so it can be reused)
        ***************************************************************************
    -->

    <ControlTemplate x:Key="ProgressBarTemplate" TargetType="ProgressBar">
        <Grid x:Name="Root">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Determinate" />
                    <VisualState x:Name="Indeterminate">
                        <Storyboard RepeatBehavior="Forever">
                            <DoubleAnimation Duration="00:00:.5"
                                             From="0"
                                             Storyboard.TargetName="IndeterminateGradientFill"
                                             Storyboard.TargetProperty="(Shape.Fill).(LinearGradientBrush.Transform).(TransformGroup.Children)[0].X"
                                             To="20" />
                            <ObjectAnimationUsingKeyFrames Duration="00:00:00"
                                                           Storyboard.TargetName="IndeterminateRoot"
                                                           Storyboard.TargetProperty="(UIElement.Visibility)">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Visible" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Duration="00:00:00"
                                                           Storyboard.TargetName="DeterminateRoot"
                                                           Storyboard.TargetProperty="(UIElement.Visibility)">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Collapsed" />
                            </ObjectAnimationUsingKeyFrames>
                            <ColorAnimation Duration="0"
                                            Storyboard.TargetName="IndeterminateGradientFill"
                                            Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)"
                                            To="#66FFFFFF"
                                            d:IsOptimized="True" />
                            <ColorAnimation Duration="0"
                                            Storyboard.TargetName="IndeterminateGradientFill"
                                            Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)"
                                            To="#66FFFFFF"
                                            d:IsOptimized="True" />
                            <ColorAnimation Duration="0"
                                            Storyboard.TargetName="IndeterminateGradientFill"
                                            Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)"
                                            To="#66FFFFFF"
                                            d:IsOptimized="True" />
                            <DoubleAnimation Duration="0"
                                             Storyboard.TargetName="IndeterminateGradientFill"
                                             Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Offset)"
                                             To="1"
                                             d:IsOptimized="True" />
                            <ColorAnimation Duration="0"
                                            Storyboard.TargetName="IndeterminateGradientFill"
                                            Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)"
                                            To="Transparent"
                                            d:IsOptimized="True" />
                            <DoubleAnimation Duration="0"
                                             Storyboard.TargetName="IndeterminateGradientFill"
                                             Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Offset)"
                                             To="0.15"
                                             d:IsOptimized="True" />
                            <DoubleAnimation Duration="0"
                                             Storyboard.TargetName="IndeterminateGradientFill"
                                             Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Offset)"
                                             To="0.85"
                                             d:IsOptimized="True" />
                            <DoubleAnimation Duration="0"
                                             Storyboard.TargetName="IndeterminateGradientFill"
                                             Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[4].(GradientStop.Offset)"
                                             To="0.85"
                                             d:IsOptimized="True" />
                            <ColorAnimation Duration="0"
                                            Storyboard.TargetName="IndeterminateGradientFill"
                                            Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[4].(GradientStop.Color)"
                                            To="#66FEFEFE"
                                            d:IsOptimized="True" />
                            <ColorAnimation Duration="0"
                                            Storyboard.TargetName="IndeterminateGradientFill"
                                            Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[5].(GradientStop.Color)"
                                            To="Transparent"
                                            d:IsOptimized="True" />
                            <DoubleAnimation Duration="0"
                                             Storyboard.TargetName="IndeterminateGradientFill"
                                             Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[5].(GradientStop.Offset)"
                                             To="0.15"
                                             d:IsOptimized="True" />
                            <DoubleAnimation Duration="0"
                                             Storyboard.TargetName="IndeterminateGradientFill"
                                             Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Offset)"
                                             To="0"
                                             d:IsOptimized="True" />
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border x:Name="OuterHighlight"
                    Margin="0,0,-1,-1"
                    BorderBrush="{StaticResource ControlOuterHighlightBrush}"
                    BorderThickness="1"
                    CornerRadius="3" />
            <Border x:Name="ProgressBarTrack"
                    Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    CornerRadius="2" />

            <!--  Inner Shadow.  -->
            <Border BorderBrush="{StaticResource InnerShadowDarkBrush}"
                    BorderThickness="1"
                    CornerRadius="2" />
            <Border Margin="1"
                    BorderBrush="{StaticResource InnerShadowLightBrush}"
                    BorderThickness="1"
                    CornerRadius="1" />
            <Grid x:Name="ProgressBarRootGrid">
                <Grid x:Name="IndeterminateRoot"
                      Margin="1"
                      Visibility="Collapsed">
                    <Rectangle x:Name="IndeterminateSolidFill"
                               Margin="{TemplateBinding BorderThickness}"
                               Fill="{TemplateBinding Foreground}"
                               Opacity="1"
                               RadiusX="1"
                               RadiusY="1"
                               RenderTransformOrigin="0.5,0.5" />
                    <Grid>
                        <Rectangle x:Name="IndeterminateGradientFill"
                                   Margin="{TemplateBinding BorderThickness}"
                                   Opacity="0.7"
                                   RadiusX="1"
                                   RadiusY="1"
                                   StrokeThickness="1">
                            <Rectangle.Fill>
                                <LinearGradientBrush MappingMode="Absolute" SpreadMethod="Repeat" StartPoint="20,1" EndPoint="0,1">
                                    <LinearGradientBrush.Transform>
                                        <TransformGroup>
                                            <TranslateTransform X="0" />
                                            <SkewTransform AngleX="-45" />
                                        </TransformGroup>
                                    </LinearGradientBrush.Transform>
                                    <GradientStop Offset="0" Color="#FFFFFFFF" />
                                    <GradientStop Offset=".25" Color="#00FFFFFF" />
                                    <GradientStop Offset="0.85" Color="#FFFFFFFF" />
                                    <GradientStop Offset="0.339" Color="#25FFFFFF" />
                                    <GradientStop Offset="0.253" Color="#33FEFEFE" />
                                    <GradientStop Offset="0.545" Color="#11FFFFFF" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <Rectangle x:Name="IndeterminateOverlay"
                                   Margin="{TemplateBinding BorderThickness}"
                                   RadiusX="1"
                                   RadiusY="1"
                                   Visibility="Collapsed">
                            <Rectangle.Fill>
                                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                    <GradientStop Offset="0" Color="#2BFFFFFF" />
                                    <GradientStop Offset="1" Color="#2B000000" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <Rectangle x:Name="IndeterminateHighlight"
                                   Margin="{TemplateBinding BorderThickness}"
                                   RadiusX="1"
                                   RadiusY="1">
                            <Rectangle.Effect>
                                <BlurEffect Radius="2" />
                            </Rectangle.Effect>
                            <Rectangle.Fill>
                                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                    <GradientStop Offset="0" Color="#26FFFFFF" />
                                    <GradientStop Offset="1" Color="Transparent" />
                                    <GradientStop Offset="0.5" Color="#26FFFFFF" />
                                    <GradientStop Offset="0.5" Color="Transparent" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                    </Grid>
                </Grid>
                <Grid x:Name="DeterminateRoot" Margin="1">
                    <Grid x:Name="ProgressBarIndicator" HorizontalAlignment="Left">
                        <Rectangle Margin="{TemplateBinding BorderThickness}"
                                   Fill="{TemplateBinding Foreground}"
                                   RadiusX="1"
                                   RadiusY="1" />
                        <Rectangle x:Name="Overlay"
                                   Margin="{TemplateBinding BorderThickness}"
                                   RadiusX="1"
                                   RadiusY="1"
                                   Visibility="Collapsed">
                            <Rectangle.Fill>
                                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                    <GradientStop Offset="0" Color="#2BFFFFFF" />
                                    <GradientStop Offset="1" Color="#2B000000" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <Rectangle x:Name="Highlight"
                                   Margin="{TemplateBinding BorderThickness}"
                                   RadiusX="1"
                                   RadiusY="1">
                            <Rectangle.Effect>
                                <BlurEffect Radius="2" />
                            </Rectangle.Effect>
                            <Rectangle.Fill>
                                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                    <GradientStop Offset="0" Color="#26FFFFFF" />
                                    <GradientStop Offset="1" Color="Transparent" />
                                    <GradientStop Offset="0.5" Color="#26FFFFFF" />
                                    <GradientStop Offset="0.5" Color="Transparent" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                    </Grid>
                </Grid>
            </Grid>
        </Grid>
    </ControlTemplate>
    <Style TargetType="ProgressBar">
        <Setter Property="Background" Value="{StaticResource ControlBackgroundAltBrush}" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Foreground" Value="{StaticResource ColorAccentBrush}" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Maximum" Value="100" />
        <Setter Property="Template" Value="{StaticResource ProgressBarTemplate}" />
    </Style>

    <!--
        ***************************************************************************
        ListBox / ListBoxItem
        ***************************************************************************
    -->

    <Style TargetType="ListBoxItem">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="Padding" Value="6,4" />
        <Setter Property="TabNavigation" Value="Local" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">
                    <Grid Background="{TemplateBinding Background}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0:0:0.1"
                                                         Storyboard.TargetName="MouseOverElement"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="contentPresenter"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0.35" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState x:Name="Unselected" />
                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="SelectedElement"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="1" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="MouseOverElement"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0" />
                                        <ColorAnimation Duration="0"
                                                        Storyboard.TargetName="contentPresenter"
                                                        Storyboard.TargetProperty="(Control.Foreground).(SolidColorBrush.Color)"
                                                        To="White"
                                                        d:IsOptimized="True" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="SelectedUnfocused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="SelectedElement"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="1" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="MouseOverElement"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0" />
                                        <ColorAnimation Duration="0"
                                                        Storyboard.TargetName="contentPresenter"
                                                        Storyboard.TargetProperty="(Control.Foreground).(SolidColorBrush.Color)"
                                                        To="White"
                                                        d:IsOptimized="True" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="FocusVisualElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="LayoutStates">
                                <VisualState x:Name="AfterLoaded" />
                                <VisualState x:Name="BeforeLoaded" />
                                <VisualState x:Name="BeforeUnloaded" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Rectangle x:Name="MouseOverElement"
                                   Fill="{StaticResource MouseOverSelectionBrush}"
                                   IsHitTestVisible="False"
                                   Opacity="0"
                                   RadiusX="0"
                                   RadiusY="0" />
                        <Rectangle x:Name="SelectedElement"
                                   Fill="{StaticResource InputSelectionBrush}"
                                   IsHitTestVisible="False"
                                   Opacity="0"
                                   RadiusX="0"
                                   RadiusY="1" />
                        <ContentControl x:Name="contentPresenter"
                                        Margin="{TemplateBinding Padding}"
                                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                        Content="{TemplateBinding Content}"
                                        ContentTemplate="{TemplateBinding ContentTemplate}"
                                        Foreground="{TemplateBinding Foreground}" />
                        <Rectangle x:Name="FocusVisualElement"
                                   Margin="2"
                                   IsHitTestVisible="False"
                                   Opacity="0"
                                   RadiusX="1"
                                   RadiusY="1"
                                   Stroke="{StaticResource FocusVisualBrush}"
                                   StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="ListBox">
        <Setter Property="Background" Value="{StaticResource InputBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Foreground" Value="{StaticResource InputForegroundBrush}" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
        <Setter Property="TabNavigation" Value="Once" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBox">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid" />
                                <VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsOpen">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <System:Boolean>True</System:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid>
                            <Border x:Name="OuterHighlight"
                                    Margin="0,0,-1,-1"
                                    BorderBrush="{StaticResource ControlOuterHighlightBrush}"
                                    BorderThickness="0,0,1,1"
                                    CornerRadius="3" />
                            <Border Margin="0"
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    CornerRadius="3">
                                <ScrollViewer x:Name="ScrollViewer"
                                              Margin="0"
                                              Background="Transparent"
                                              BorderBrush="Transparent"
                                              BorderThickness="0"
                                              Padding="0"
                                              TabNavigation="{TemplateBinding TabNavigation}">
                                    <ItemsPresenter Margin="0,0" />
                                </ScrollViewer>
                            </Border>
                            <!--  Inner Shadow.  -->
                            <Border Margin="1"
                                    BorderBrush="{StaticResource InnerShadowDarkBrush}"
                                    BorderThickness="1,1,0,0"
                                    CornerRadius="2" />
                            <Border Margin="2,2,1,1"
                                    BorderBrush="{StaticResource InnerShadowLightBrush}"
                                    BorderThickness="1,1,0,0"
                                    CornerRadius="1" />
                        </Grid>
                        <Border x:Name="ValidationErrorElement"
                                BorderBrush="{StaticResource ErrorBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="3"
                                Visibility="Collapsed">
                            <ToolTipService.ToolTip>
                                <ToolTip x:Name="validationTooltip"
                                         DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                         Placement="Right"
                                         PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                         Template="{StaticResource ValidationToolTipTemplate}">
                                    <ToolTip.Triggers>
                                        <EventTrigger RoutedEvent="Canvas.Loaded">
                                            <BeginStoryboard>
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsHitTestVisible">
                                                        <DiscreteObjectKeyFrame KeyTime="0">
                                                            <DiscreteObjectKeyFrame.Value>
                                                                <System:Boolean>true</System:Boolean>
                                                            </DiscreteObjectKeyFrame.Value>
                                                        </DiscreteObjectKeyFrame>
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </EventTrigger>
                                    </ToolTip.Triggers>
                                </ToolTip>
                            </ToolTipService.ToolTip>
                            <Grid Width="10"
                                  Height="10"
                                  Margin="0,-4,-4,0"
                                  HorizontalAlignment="Right"
                                  VerticalAlignment="Top"
                                  Background="Transparent">
                                <Path Margin="-1,3,0,0"
                                      Data="M 1,0 L6,0 A 2,2 90 0 1 8,2 L8,7 z"
                                      Fill="{StaticResource ErrorBrush}" />
                            </Grid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        ComboBox / ComboBoxItem
        ***************************************************************************
    -->

    <Style TargetType="ComboBoxItem">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="Padding" Value="6,4" />
        <Setter Property="TabNavigation" Value="Local" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ComboBoxItem">
                    <Grid Background="{TemplateBinding Background}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0:0:0.1"
                                                         Storyboard.TargetName="MouseOverElement"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="contentPresenter"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0.35" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState x:Name="Unselected" />
                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="SelectedElement"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="1" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="MouseOverElement"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0" />
                                        <ColorAnimation Duration="0"
                                                        Storyboard.TargetName="contentPresenter"
                                                        Storyboard.TargetProperty="(Control.Foreground).(SolidColorBrush.Color)"
                                                        To="White"
                                                        d:IsOptimized="True" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="SelectedUnfocused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="SelectedElement"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="1" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="MouseOverElement"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0" />
                                        <ColorAnimation Duration="0"
                                                        Storyboard.TargetName="contentPresenter"
                                                        Storyboard.TargetProperty="(Control.Foreground).(SolidColorBrush.Color)"
                                                        To="White"
                                                        d:IsOptimized="True" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="FocusVisualElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="LayoutStates">
                                <VisualState x:Name="AfterLoaded" />
                                <VisualState x:Name="BeforeLoaded" />
                                <VisualState x:Name="BeforeUnloaded" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Rectangle x:Name="MouseOverElement"
                                   Fill="{StaticResource MouseOverSelectionBrush}"
                                   IsHitTestVisible="False"
                                   Opacity="0"
                                   RadiusX="0"
                                   RadiusY="0" />
                        <Rectangle x:Name="SelectedElement"
                                   Fill="{StaticResource InputSelectionBrush}"
                                   IsHitTestVisible="False"
                                   Opacity="0"
                                   RadiusX="0"
                                   RadiusY="1" />
                        <ContentControl x:Name="contentPresenter"
                                        Margin="{TemplateBinding Padding}"
                                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                        Content="{TemplateBinding Content}"
                                        ContentTemplate="{TemplateBinding ContentTemplate}" />
                        <Rectangle x:Name="FocusVisualElement"
                                   Margin="2"
                                   IsHitTestVisible="False"
                                   Opacity="0"
                                   RadiusX="1"
                                   RadiusY="1"
                                   Stroke="{StaticResource FocusVisualBrush}"
                                   StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ComboBoxButton" TargetType="ToggleButton">
        <Setter Property="Padding" Value="18,6" />
        <Setter Property="TextOptions.TextHintingMode" Value="Animated" />
        <Setter Property="Foreground" Value="{StaticResource ControlForeground}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ToggleButton">
                    <Grid x:Name="Root">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.1" />
                                    <VisualTransition To="Pressed" />
                                    <VisualTransition From="Pressed" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="PressedElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="MouseOverElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="NormalElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0.25" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="PressedElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="MouseOverElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="NormalElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="DisabledElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="HighlightElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0.5" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="ContentHost"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="0.75" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused" />
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="DisabledElement"
                                Background="{StaticResource DisabledBrush}"
                                CornerRadius="2"
                                Opacity="0">
                            <Border BorderBrush="{StaticResource DisabledBorderBrush}"
                                    BorderThickness="0,0,1,1"
                                    CornerRadius="2" />
                        </Border>
                        <Border x:Name="NormalElement"
                                Background="{StaticResource ControlBackgroundNormal}"
                                CornerRadius="2"
                                Effect="{StaticResource ControlShadowEffect}" />
                        <Border x:Name="MouseOverElement"
                                Background="{StaticResource ControlBackgroundOver}"
                                CornerRadius="2"
                                Opacity="0" />
                        <Border x:Name="PressedElement"
                                Background="{StaticResource ControlBackgroundPressed}"
                                CornerRadius="2"
                                Opacity="0" />
                        <Border x:Name="HighlightElement"
                                BorderBrush="{StaticResource ControlHighlight}"
                                BorderThickness="1,1,0,0"
                                CornerRadius="2" />
                        <ContentPresenter x:Name="ContentHost"
                                          Margin="{TemplateBinding Padding}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <ContentPresenter.Effect>
                                <DropShadowEffect BlurRadius="1"
                                                  Direction="-90"
                                                  Opacity="0.5"
                                                  ShadowDepth="1"
                                                  Color="{StaticResource ColorForegroundShadowColor}" />
                            </ContentPresenter.Effect>
                        </ContentPresenter>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="ComboBox">
        <Setter Property="Padding" Value="12,6,25,6" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="TabNavigation" Value="Once" />
        <Setter Property="Foreground" Value="{StaticResource ControlForeground}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ComboBox">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="HighlightLine"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="ShadowLine"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused" />
                                <VisualState x:Name="Unfocused" />
                                <VisualState x:Name="FocusedDropDown">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="00:00:00"
                                                                       Storyboard.TargetName="PopupBorder"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="ContentPresenterBorder">
                            <Grid>
                                <ToggleButton x:Name="DropDownToggle"
                                              Margin="0"
                                              HorizontalAlignment="Stretch"
                                              VerticalAlignment="Stretch"
                                              HorizontalContentAlignment="Right"
                                              Padding="3"
                                              Style="{StaticResource ComboBoxButton}">
                                    <Path x:Name="BtnArrow"
                                          Width="8"
                                          Height="4"
                                          Margin="0,0,6,0"
                                          HorizontalAlignment="Right"
                                          Data="M0,0 L1,0 0.5,1Z"
                                          Fill="#606060"
                                          Stretch="Fill" />
                                </ToggleButton>
                                <Rectangle x:Name="HighlightLine"
                                           Width="1"
                                           Margin="0,2,26,2"
                                           HorizontalAlignment="Right">
                                    <Rectangle.Fill>
                                        <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                                            <GradientStop Offset="0" Color="#0FFF" />
                                            <GradientStop Offset="0.3" Color="#FFFF" />
                                            <GradientStop Offset="0.7" Color="#AFFF" />
                                            <GradientStop Offset="1" Color="#0FFF" />
                                        </LinearGradientBrush>
                                    </Rectangle.Fill>
                                </Rectangle>
                                <Rectangle x:Name="ShadowLine"
                                           Width="1"
                                           Margin="0,2,27,2"
                                           HorizontalAlignment="Right">
                                    <Rectangle.Fill>
                                        <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                                            <GradientStop Offset="0" Color="#0000" />
                                            <GradientStop Offset="0.3" Color="#3000" />
                                            <GradientStop Offset="0.7" Color="#3000" />
                                            <GradientStop Offset="1" Color="#0000" />
                                        </LinearGradientBrush>
                                    </Rectangle.Fill>
                                </Rectangle>
                                <ContentPresenter x:Name="ContentPresenter"
                                                  Margin="{TemplateBinding Padding}"
                                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                                    <ContentPresenter.Effect>
                                        <DropShadowEffect BlurRadius="1"
                                                          Direction="-90"
                                                          Opacity="0.5"
                                                          ShadowDepth="1"
                                                          Color="{StaticResource ColorForegroundShadowColor}" />
                                    </ContentPresenter.Effect>
                                    <TextBlock Text=" " />
                                </ContentPresenter>
                            </Grid>
                        </Border>
                        <Popup x:Name="Popup" Margin="0,1,0,0">
                            <Border x:Name="PopupBorder"
                                    Height="Auto"
                                    HorizontalAlignment="Stretch"
                                    Background="{StaticResource InputBackgroundBrush}"
                                    CornerRadius="0,0,4,4"
                                    Effect="{StaticResource ControlShadowEffect}">
                                <ScrollViewer x:Name="ScrollViewer"
                                              Margin="0,0,0,4"
                                              BorderThickness="0"
                                              Padding="0">
                                    <ItemsPresenter />
                                </ScrollViewer>
                            </Border>
                        </Popup>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        Slider
        ***************************************************************************
    -->

    <Style x:Key="HorizontalSliderThumb" TargetType="Thumb">
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Thumb">
                    <Grid>
                        <Path x:Name="ThumbElement"
                              Data="M-0.40,4.15C-0.40,3.60 0.37,2.89 0.92,2.89L8.07,2.89C8.62,2.89 9.40,3.60 9.40,4.15L9.40,11.06C 9.40,11.61 4.40,15.5 4.40,15.5C4.40,15.5 -0.40,11.61 -0.40,11.06z"
                              Stretch="Fill"
                              StrokeThickness="0"
                              UseLayoutRounding="False">
                            <Path.Stroke>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                                    <GradientStop Offset="0" Color="#FFFDFDFD" />
                                    <GradientStop Offset="1" Color="#FF868788" />
                                </LinearGradientBrush>
                            </Path.Stroke>
                            <Path.Fill>
                                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                    <GradientStop Offset="0" Color="#FFFDFDFD" />
                                    <GradientStop Offset="1" Color="#FF9D9D9E" />
                                </LinearGradientBrush>
                            </Path.Fill>
                            <Path.Effect>
                                <DropShadowEffect BlurRadius="4"
                                                  Opacity="0.5"
                                                  ShadowDepth="1" />
                            </Path.Effect>
                        </Path>
                        <Border Margin="0,0,0,4"
                                BorderBrush="{StaticResource ControlHighlight}"
                                BorderThickness="1,1,0,0"
                                CornerRadius="3" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="VerticalSliderThumb" TargetType="Thumb">
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Thumb">
                    <Grid Width="16" Height="12">
                        <Path Data="M1.6027589,0 L10.366944,0 C11.068047,0 16,6.1111116 16,6.1111116 C16,6.1111116 11.068047,12 10.366944,12 L1.6027589,12 C0.90168238,12 0,11.043701 0,10.368687 L0,1.6313124 C0,0.9562912 0.90168238,0 1.6027589,0 z"
                              Stretch="Fill"
                              StrokeThickness="0"
                              UseLayoutRounding="False">
                            <Path.Effect>
                                <DropShadowEffect BlurRadius="4"
                                                  Opacity="0.5"
                                                  ShadowDepth="1" />
                            </Path.Effect>
                            <Path.Fill>
                                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                    <GradientStop Offset="0" Color="#FFFDFDFD" />
                                    <GradientStop Offset="1" Color="#FF9D9D9E" />
                                </LinearGradientBrush>
                            </Path.Fill>
                            <Path.Stroke>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                                    <GradientStop Offset="0" Color="#FFFDFDFD" />
                                    <GradientStop Offset="1" Color="#FF868788" />
                                </LinearGradientBrush>
                            </Path.Stroke>
                        </Path>
                        <Border Margin="0,0,4,0"
                                BorderBrush="{StaticResource ControlHighlight}"
                                BorderThickness="1,1,0,0"
                                CornerRadius="3" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="Slider">
        <Setter Property="Background" Value="{StaticResource ControlBackgroundAltBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Maximum" Value="10" />
        <Setter Property="Minimum" Value="0" />
        <Setter Property="Value" Value="0" />
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Slider">
                    <Grid x:Name="Root">
                        <Grid.Resources>
                            <ControlTemplate x:Key="RepeatButtonTemplate">
                                <Grid x:Name="Root"
                                      Background="Transparent"
                                      Opacity="0" />
                            </ControlTemplate>
                        </Grid.Resources>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="HorizontalTrackRectangleDisabledOverlay"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="VerticalTrackRectangleDisabledOverlay"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="FocusVisualElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid x:Name="HorizontalTemplate">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Grid Grid.ColumnSpan="3"
                                  Height="8"
                                  Margin="0,3,0,0"
                                  VerticalAlignment="Top">
                                <Border x:Name="Border"
                                        BorderBrush="#D0505050"
                                        BorderThickness="1"
                                        CornerRadius="2"
                                        Opacity="1">
                                    <Border.Background>
                                        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                            <GradientStop Offset="0.3" Color="#57575c" />
                                            <GradientStop Offset="1.0" Color="#505054" />
                                        </LinearGradientBrush>
                                    </Border.Background>
                                </Border>
                                <Border x:Name="DarkEdge"
                                        Margin="0"
                                        BorderBrush="{StaticResource ControlDarkEdge}"
                                        BorderThickness="1,1,0,0"
                                        CornerRadius="2" />
                                <Border x:Name="OuterHighlight"
                                        Margin="0,0,-1,-1"
                                        BorderBrush="{StaticResource ControlOuterHighlightBrush}"
                                        BorderThickness="0,0,1,1"
                                        CornerRadius="2" />
                                <Border x:Name="InnerShadowDark"
                                        Margin="1"
                                        BorderBrush="#50303030"
                                        BorderThickness="1,1,0,0"
                                        CornerRadius="1" />
                                <Border x:Name="InnerShadowLight"
                                        Margin="2"
                                        BorderBrush="#20303030"
                                        BorderThickness="1,1,0,0"
                                        CornerRadius="1" />
                            </Grid>
                            <Border x:Name="HorizontalValueElement"
                                    Grid.ColumnSpan="2"
                                    Height="8"
                                    Margin="0,3,4,0"
                                    VerticalAlignment="Top"
                                    BorderThickness="1"
                                    CornerRadius="2">
                                <Border.BorderBrush>
                                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                        <GradientStop Offset="0" Color="#FF38383C" />
                                        <GradientStop Offset="1" Color="#FF424247" />
                                    </LinearGradientBrush>
                                </Border.BorderBrush>
                                <Border BorderThickness="1" CornerRadius="1">
                                    <Border.BorderBrush>
                                        <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                            <GradientStop Offset="0" Color="#FFF1F1F1" />
                                            <GradientStop Offset="1" Color="#FF969696" />
                                        </LinearGradientBrush>
                                    </Border.BorderBrush>
                                    <Border.Background>
                                        <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                            <GradientStop Offset="0" Color="#FFCCCCCC" />
                                            <GradientStop Offset="1" Color="#FF9F9F9F" />
                                        </LinearGradientBrush>
                                    </Border.Background>
                                </Border>
                            </Border>
                            <Rectangle x:Name="HorizontalTrackRectangleDisabledOverlay"
                                       Grid.Column="0"
                                       Grid.ColumnSpan="3"
                                       Height="10"
                                       Margin="0,3,0,0"
                                       VerticalAlignment="Top"
                                       Fill="{StaticResource DisabledBrush}"
                                       Opacity=".55"
                                       RadiusX="2"
                                       RadiusY="2"
                                       Visibility="Collapsed" />
                            <Thumb x:Name="HorizontalThumb"
                                   Grid.Column="1"
                                   Width="12"
                                   Height="16"
                                   IsTabStop="True"
                                   Style="{StaticResource HorizontalSliderThumb}" />
                            <RepeatButton x:Name="HorizontalTrackLargeChangeDecreaseRepeatButton"
                                          Grid.Column="0"
                                          Height="18"
                                          IsTabStop="False"
                                          Template="{StaticResource RepeatButtonTemplate}" />
                            <RepeatButton x:Name="HorizontalTrackLargeChangeIncreaseRepeatButton"
                                          Grid.Column="2"
                                          Height="18"
                                          IsTabStop="False"
                                          Template="{StaticResource RepeatButtonTemplate}" />
                        </Grid>
                        <Grid x:Name="VerticalTemplate">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Grid Grid.RowSpan="3"
                                  Width="8"
                                  Margin="3,0,0,0"
                                  HorizontalAlignment="Left">
                                <Border x:Name="VertBorder"
                                        BorderBrush="#D0505050"
                                        BorderThickness="1"
                                        CornerRadius="2"
                                        Opacity="1">
                                    <Border.Background>
                                        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                            <GradientStop Offset="0.3" Color="#57575c" />
                                            <GradientStop Offset="1.0" Color="#505054" />
                                        </LinearGradientBrush>
                                    </Border.Background>
                                </Border>
                                <Border x:Name="VertDarkEdge"
                                        Margin="0"
                                        BorderBrush="{StaticResource ControlDarkEdge}"
                                        BorderThickness="1,1,0,0"
                                        CornerRadius="2" />
                                <Border x:Name="VertOuterHighlight"
                                        Margin="0,0,-1,-1"
                                        BorderBrush="{StaticResource ControlOuterHighlightBrush}"
                                        BorderThickness="0,0,1,1"
                                        CornerRadius="2" />
                                <Border x:Name="VertInnerShadowDark"
                                        Margin="1"
                                        BorderBrush="#50303030"
                                        BorderThickness="1,1,0,0"
                                        CornerRadius="1" />
                                <Border x:Name="VertInnerShadowLight"
                                        Margin="2"
                                        BorderBrush="#20303030"
                                        BorderThickness="1,1,0,0"
                                        CornerRadius="1" />
                            </Grid>
                            <Border x:Name="VerticalValueElement"
                                    Grid.Row="1"
                                    Grid.RowSpan="2"
                                    Width="8"
                                    Margin="0,3,4,0"
                                    BorderThickness="1"
                                    CornerRadius="2">
                                <Border.BorderBrush>
                                    <LinearGradientBrush StartPoint="1,0.5" EndPoint="0,0.5">
                                        <GradientStop Offset="0" Color="#FF424247" />
                                        <GradientStop Offset="1" Color="#FF38383C" />
                                    </LinearGradientBrush>
                                </Border.BorderBrush>
                                <Border BorderThickness="1" CornerRadius="1">
                                    <Border.BorderBrush>
                                        <LinearGradientBrush StartPoint="1,0.5" EndPoint="0,0.5">
                                            <GradientStop Offset="0" Color="#FF969696" />
                                            <GradientStop Offset="1" Color="#FFF1F1F1" />
                                        </LinearGradientBrush>
                                    </Border.BorderBrush>
                                    <Border.Background>
                                        <LinearGradientBrush StartPoint="1,0.5" EndPoint="0,0.5">
                                            <GradientStop Offset="0" Color="#FF9F9F9F" />
                                            <GradientStop Offset="1" Color="#FFCCCCCC" />
                                        </LinearGradientBrush>
                                    </Border.Background>
                                </Border>
                            </Border>
                            <Rectangle x:Name="VerticalTrackRectangleDisabledOverlay"
                                       Grid.Row="0"
                                       Grid.RowSpan="3"
                                       Width="10"
                                       Margin="3,0,0,0"
                                       HorizontalAlignment="Left"
                                       Fill="{StaticResource DisabledBrush}"
                                       Opacity=".55"
                                       RadiusX="2"
                                       RadiusY="2"
                                       Visibility="Collapsed" />
                            <Thumb x:Name="VerticalThumb"
                                   Grid.Row="1"
                                   Width="16"
                                   Height="12"
                                   IsTabStop="True"
                                   Style="{StaticResource VerticalSliderThumb}" />
                            <RepeatButton x:Name="VerticalTrackLargeChangeDecreaseRepeatButton"
                                          Width="18"
                                          IsTabStop="False"
                                          Template="{StaticResource RepeatButtonTemplate}" />
                            <RepeatButton x:Name="VerticalTrackLargeChangeIncreaseRepeatButton"
                                          Grid.Row="2"
                                          Width="18"
                                          IsTabStop="False"
                                          Template="{StaticResource RepeatButtonTemplate}" />
                        </Grid>
                        <Rectangle x:Name="FocusVisualElement"
                                   Margin="-2"
                                   IsHitTestVisible="False"
                                   Opacity="0"
                                   RadiusX="2"
                                   RadiusY="2"
                                   Stroke="{StaticResource FocusVisualBrush}"
                                   StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        ScrollBar
        ***************************************************************************
    -->

    <Style TargetType="ScrollBar">
        <Setter Property="MinWidth" Value="18" />
        <Setter Property="MinHeight" Value="18" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Background" Value="{StaticResource ScrollBackgroundBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ScrollBar">
                    <Grid x:Name="Root">
                        <Grid.Resources>
                            <ControlTemplate x:Key="LargeChangeButton" TargetType="RepeatButton">
                                <Grid x:Name="Root" Background="Transparent">
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup x:Name="CommonStates">
                                            <VisualState x:Name="Normal" />
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                </Grid>
                            </ControlTemplate>
                            <ControlTemplate x:Key="SmallChangeButton" TargetType="RepeatButton">
                                <Grid x:Name="Root">
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup x:Name="CommonStates">
                                            <VisualStateGroup.Transitions>
                                                <VisualTransition GeneratedDuration="0:0:0.1" />
                                            </VisualStateGroup.Transitions>
                                            <VisualState x:Name="Normal" />
                                            <VisualState x:Name="MouseOver">
                                                <Storyboard>
                                                    <ColorAnimation Storyboard.TargetName="Background"
                                                                    Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
                                                                    To="#2000" />
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Pressed">
                                                <Storyboard>
                                                    <ColorAnimation Storyboard.TargetName="Background"
                                                                    Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
                                                                    To="#4000" />
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Disabled">
                                                <Storyboard>
                                                    <DoubleAnimation Duration="0:0:0"
                                                                     Storyboard.TargetName="Background"
                                                                     Storyboard.TargetProperty="Opacity"
                                                                     To=".7" />
                                                </Storyboard>
                                            </VisualState>
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                    <Border x:Name="Background" Background="#0000">
                                        <ContentPresenter Margin="{TemplateBinding Padding}" />
                                    </Border>
                                </Grid>
                            </ControlTemplate>
                            <ControlTemplate x:Key="HorizontalThumbTemplate" TargetType="Thumb">
                                <Grid>
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup x:Name="CommonStates">
                                            <VisualStateGroup.Transitions>
                                                <VisualTransition GeneratedDuration="0:0:0.1" />
                                            </VisualStateGroup.Transitions>
                                            <VisualState x:Name="Normal" />
                                            <VisualState x:Name="MouseOver">
                                                <Storyboard>
                                                    <DoubleAnimation Duration="0:0:0"
                                                                     Storyboard.TargetName="Background"
                                                                     Storyboard.TargetProperty="Opacity"
                                                                     To="1.0" />
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Disabled">
                                                <Storyboard>
                                                    <DoubleAnimation Duration="0:0:0"
                                                                     Storyboard.TargetName="Background"
                                                                     Storyboard.TargetProperty="Opacity"
                                                                     To="0" />
                                                </Storyboard>
                                            </VisualState>
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                    <Border x:Name="Background"
                                            Margin="1"
                                            BorderBrush="White"
                                            BorderThickness="1,1,0,0"
                                            CornerRadius="1,4,2,2">
                                        <Border.Effect>
                                            <DropShadowEffect BlurRadius="4"
                                                              Opacity="0.3"
                                                              ShadowDepth="0" />
                                        </Border.Effect>
                                        <Border.Background>
                                            <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                                <GradientStop Offset="0.1" Color="#f8f8f8" />
                                                <GradientStop Offset="1.0" Color="#c0c0c0" />
                                            </LinearGradientBrush>
                                        </Border.Background>
                                        <Border Margin="-1,-1,0,0"
                                                BorderBrush="#40000000"
                                                BorderThickness="0,0,1,1"
                                                CornerRadius="0,2,2,2" />
                                    </Border>
                                </Grid>
                            </ControlTemplate>
                            <ControlTemplate x:Key="VerticalThumbTemplate" TargetType="Thumb">
                                <Grid>
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup x:Name="CommonStates">
                                            <VisualStateGroup.Transitions>
                                                <VisualTransition GeneratedDuration="0:0:0.1" />
                                            </VisualStateGroup.Transitions>
                                            <VisualState x:Name="Normal" />
                                            <VisualState x:Name="MouseOver">
                                                <Storyboard>
                                                    <DoubleAnimation Duration="0:0:0"
                                                                     Storyboard.TargetName="Background"
                                                                     Storyboard.TargetProperty="Opacity"
                                                                     To="1.0" />
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Disabled">
                                                <Storyboard>
                                                    <DoubleAnimation Duration="0:0:0"
                                                                     Storyboard.TargetName="Background"
                                                                     Storyboard.TargetProperty="Opacity"
                                                                     To="0" />
                                                </Storyboard>
                                            </VisualState>
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                    <Border x:Name="Background"
                                            Margin="1"
                                            BorderBrush="White"
                                            BorderThickness="1,1,0,0"
                                            CornerRadius="1,4,2,2">
                                        <Border.Effect>
                                            <DropShadowEffect BlurRadius="4"
                                                              Opacity="0.3"
                                                              ShadowDepth="0" />
                                        </Border.Effect>
                                        <Border.Background>
                                            <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                                                <GradientStop Offset="0.1" Color="#f8f8f8" />
                                                <GradientStop Offset="1.0" Color="#c0c0c0" />
                                            </LinearGradientBrush>
                                        </Border.Background>
                                        <Border Margin="-1,-1,0,0"
                                                BorderBrush="#40000000"
                                                BorderThickness="0,0,1,1"
                                                CornerRadius="0,2,2,2" />
                                    </Border>
                                </Grid>
                            </ControlTemplate>
                        </Grid.Resources>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="Root"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0.5" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid x:Name="HorizontalRoot">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Border Grid.ColumnSpan="5"
                                    Background="{TemplateBinding Background}"
                                    CornerRadius="0,0,2.5,2.5" />
                            <RepeatButton x:Name="HorizontalSmallDecrease"
                                          Grid.Column="0"
                                          Width="18"
                                          Interval="50"
                                          IsTabStop="False"
                                          Padding="0"
                                          Template="{StaticResource SmallChangeButton}">
                                <Path Width="4"
                                      Height="7"
                                      Data="M0,0.5 L1,1 1,0Z"
                                      Fill="#404040"
                                      Stretch="Fill" />
                            </RepeatButton>
                            <RepeatButton x:Name="HorizontalLargeDecrease"
                                          Grid.Column="1"
                                          Width="0"
                                          Interval="50"
                                          IsTabStop="False"
                                          Template="{StaticResource LargeChangeButton}" />
                            <Thumb x:Name="HorizontalThumb"
                                   Grid.Column="2"
                                   MinWidth="18"
                                   Margin="0,2"
                                   Template="{StaticResource HorizontalThumbTemplate}" />
                            <RepeatButton x:Name="HorizontalLargeIncrease"
                                          Grid.Column="3"
                                          Interval="50"
                                          IsTabStop="False"
                                          Template="{StaticResource LargeChangeButton}" />
                            <RepeatButton x:Name="HorizontalSmallIncrease"
                                          Grid.Column="4"
                                          Width="18"
                                          Interval="50"
                                          IsTabStop="False"
                                          Padding="0"
                                          Template="{StaticResource SmallChangeButton}">
                                <Path Width="4"
                                      Height="7"
                                      Data="M0,0 L1,0.5 0,1Z"
                                      Fill="#606060"
                                      Stretch="Fill" />
                            </RepeatButton>
                        </Grid>
                        <Grid x:Name="VerticalRoot" Visibility="Collapsed">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Border Grid.RowSpan="5"
                                    Background="{TemplateBinding Background}"
                                    CornerRadius="0,2.5,2.5,0" />
                            <RepeatButton x:Name="VerticalSmallDecrease"
                                          Grid.Row="0"
                                          Height="16"
                                          Interval="50"
                                          IsTabStop="False"
                                          Padding="-1,0,1,0"
                                          Template="{StaticResource SmallChangeButton}">
                                <Path Width="7"
                                      Height="4"
                                      Data="M0,1 L1,1 0.5,0Z"
                                      Fill="#606060"
                                      Stretch="Fill" />
                            </RepeatButton>
                            <RepeatButton x:Name="VerticalLargeDecrease"
                                          Grid.Row="1"
                                          Height="18"
                                          Interval="50"
                                          IsTabStop="False"
                                          Template="{StaticResource LargeChangeButton}" />
                            <Thumb x:Name="VerticalThumb"
                                   Grid.Row="2"
                                   Height="16"
                                   MinHeight="16"
                                   Margin="2,0"
                                   Template="{StaticResource VerticalThumbTemplate}" />
                            <RepeatButton x:Name="VerticalLargeIncrease"
                                          Grid.Row="3"
                                          Interval="50"
                                          IsTabStop="False"
                                          Template="{StaticResource LargeChangeButton}" />
                            <RepeatButton x:Name="VerticalSmallIncrease"
                                          Grid.Row="4"
                                          Height="18"
                                          Interval="50"
                                          IsTabStop="False"
                                          Padding="-1,0,1,0"
                                          Template="{StaticResource SmallChangeButton}">
                                <Path Width="7"
                                      Height="4"
                                      Data="M0,0 L1,0 0.5,1Z"
                                      Fill="#606060"
                                      Stretch="Fill" />
                            </RepeatButton>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        ScrollViewer
        ***************************************************************************
    -->

    <Style TargetType="ScrollViewer">
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="VerticalScrollBarVisibility" Value="Visible" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="BorderBrush" Value="#80404040" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ScrollViewer">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            CornerRadius="2.5">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <ScrollContentPresenter x:Name="ScrollContentPresenter"
                                                    Margin="{TemplateBinding Padding}"
                                                    ContentTemplate="{TemplateBinding ContentTemplate}" />
                            <Border Grid.Row="1"
                                    Grid.Column="1"
                                    Margin="0,-5,0,0"
                                    Background="{StaticResource ScrollBackgroundBrush}"
                                    CornerRadius="0,0,2.5,0" />
                            <Border Grid.Row="1"
                                    Grid.Column="1"
                                    Margin="-5,0,0,0"
                                    Background="{StaticResource ScrollBackgroundBrush}"
                                    CornerRadius="0,0,2.5,0" />
                            <ScrollBar x:Name="VerticalScrollBar"
                                       Grid.Row="0"
                                       Grid.Column="1"
                                       Width="18"
                                       IsTabStop="False"
                                       Maximum="{TemplateBinding ScrollableHeight}"
                                       Minimum="0"
                                       Orientation="Vertical"
                                       ViewportSize="{TemplateBinding ViewportHeight}"
                                       Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
                                       Value="{TemplateBinding VerticalOffset}" />
                            <ScrollBar x:Name="HorizontalScrollBar"
                                       Grid.Row="1"
                                       Grid.Column="0"
                                       Height="18"
                                       IsTabStop="False"
                                       Maximum="{TemplateBinding ScrollableWidth}"
                                       Minimum="0"
                                       Orientation="Horizontal"
                                       ViewportSize="{TemplateBinding ViewportWidth}"
                                       Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
                                       Value="{TemplateBinding HorizontalOffset}" />
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        DarkTextBox
        ***************************************************************************
    -->

    <Style x:Key="DarkTextBox" TargetType="TextBox">
        <Setter Property="Background" Value="{StaticResource DarkControlBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource DarkControlBorderBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Foreground" Value="White" />
        <Setter Property="Padding" Value="5,4,5,4" />
        <Setter Property="SelectionBackground" Value="{StaticResource InputSelectionBrush}" />
        <Setter Property="SelectionForeground" Value="{StaticResource DarkControlForegroundBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="TextBox">
                    <Grid x:Name="RootElement">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="DisabledVisualElement"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0.55" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="ContentElement"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="0.5" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="ReadOnly">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="ReadOnlyVisualElement"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0.55" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="FocusVisualElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid" />
                                <VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsOpen">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <System:Boolean>True</System:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Border"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="2.5"
                                Opacity="1">
                            <Grid>
                                <Border x:Name="ReadOnlyVisualElement"
                                        Background="{StaticResource DarkReadOnlyBrush}"
                                        CornerRadius="2"
                                        Opacity="0" />
                                <ScrollViewer x:Name="ContentElement"
                                              Margin="1"
                                              BorderThickness="0"
                                              IsTabStop="False"
                                              Padding="{TemplateBinding Padding}" />
                            </Grid>
                        </Border>
                        <Border x:Name="DarkEdge"
                                Margin="0"
                                BorderBrush="{StaticResource ControlDarkEdge}"
                                BorderThickness="1,1,0,0"
                                CornerRadius="2.5" />
                        <Border x:Name="OuterHighlight"
                                Margin="0,0,-1,-1"
                                BorderBrush="{StaticResource ControlOuterHighlightBrush}"
                                BorderThickness="0,0,1,1"
                                CornerRadius="3" />
                        <Border x:Name="InnerShadowDark"
                                Margin="1"
                                BorderBrush="{StaticResource DarkInnerShadowDarkBrush}"
                                BorderThickness="1,1,0,0"
                                CornerRadius="2" />
                        <Border x:Name="InnerShadowLight"
                                Margin="2"
                                BorderBrush="{StaticResource DarkInnerShadowLightBrush}"
                                BorderThickness="1,1,0,0"
                                CornerRadius="1" />
                        <Border x:Name="DisabledVisualElement"
                                Margin="1"
                                Background="{StaticResource DarkDisabledBrush}"
                                CornerRadius="2"
                                IsHitTestVisible="False"
                                Opacity="0" />
                        <Rectangle x:Name="FocusVisualElement"
                                   Margin="2"
                                   IsHitTestVisible="False"
                                   Opacity="0"
                                   RadiusX="1"
                                   RadiusY="1"
                                   Stroke="{StaticResource FocusVisualBrush}"
                                   StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                        <Border x:Name="ValidationErrorElement"
                                BorderBrush="{StaticResource ErrorBrush}"
                                BorderThickness="1"
                                CornerRadius="3"
                                Visibility="Collapsed">
                            <ToolTipService.ToolTip>
                                <ToolTip x:Name="validationTooltip"
                                         DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                         Placement="Right"
                                         PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                         Template="{StaticResource ValidationToolTipTemplate}">
                                    <ToolTip.Triggers>
                                        <EventTrigger RoutedEvent="Canvas.Loaded">
                                            <BeginStoryboard>
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsHitTestVisible">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="True" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </EventTrigger>
                                    </ToolTip.Triggers>
                                </ToolTip>
                            </ToolTipService.ToolTip>
                            <Grid Width="12"
                                  Height="12"
                                  Margin="1,-4,-4,0"
                                  HorizontalAlignment="Right"
                                  VerticalAlignment="Top"
                                  Background="Transparent">
                                <Path Margin="1,3,0,0"
                                      Data="M 1,0 L6,0 A 2,2 90 0 1 8,2 L8,7 z"
                                      Fill="{StaticResource ErrorBrush}" />
                            </Grid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        ***************************************************************************
        DarkPasswordBox
        ***************************************************************************
    -->

    <Style x:Key="DarkPasswordBox" TargetType="PasswordBox">
        <Setter Property="Background" Value="{StaticResource DarkControlBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource DarkControlBorderBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Foreground" Value="{StaticResource DarkControlForegroundBrush}" />
        <Setter Property="Padding" Value="5,4,5,4" />
        <Setter Property="SelectionBackground" Value="{StaticResource InputSelectionBrush}" />
        <Setter Property="SelectionForeground" Value="{StaticResource InputSelectionForegroundBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="PasswordBox">
                    <Grid x:Name="RootElement">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="DisabledVisualElement"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0.55" />
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="ContentElement"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         To="0.5" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="ReadOnly">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="ReadOnlyVisualElement"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0.55" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         Storyboard.TargetName="FocusVisualElement"
                                                         Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid" />
                                <VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsOpen">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <System:Boolean>True</System:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Border"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="2.5"
                                Opacity="1">
                            <Grid>
                                <Border x:Name="ReadOnlyVisualElement"
                                        Background="{StaticResource DarkDisabledBrush}"
                                        CornerRadius="2"
                                        Opacity="0" />
                                <Border x:Name="ContentElement"
                                        Margin="1"
                                        BorderThickness="0"
                                        Padding="{TemplateBinding Padding}" />
                            </Grid>
                        </Border>
                        <Border x:Name="DarkEdge"
                                Margin="0"
                                BorderBrush="{StaticResource ControlDarkEdge}"
                                BorderThickness="1,1,0,0"
                                CornerRadius="2.5" />
                        <Border x:Name="OuterHighlight"
                                Margin="0,0,-1,-1"
                                BorderBrush="{StaticResource ControlOuterHighlightBrush}"
                                BorderThickness="0,0,1,1"
                                CornerRadius="3" />
                        <Border x:Name="InnerShadowDark"
                                Margin="1"
                                BorderBrush="{StaticResource DarkInnerShadowDarkBrush}"
                                BorderThickness="1,1,0,0"
                                CornerRadius="2" />
                        <Border x:Name="InnerShadowLight"
                                Margin="2"
                                BorderBrush="{StaticResource DarkInnerShadowLightBrush}"
                                BorderThickness="1,1,0,0"
                                CornerRadius="1" />
                        <Border x:Name="DisabledVisualElement"
                                Margin="1"
                                Background="{StaticResource DarkDisabledBrush}"
                                CornerRadius="2"
                                IsHitTestVisible="False"
                                Opacity="0" />
                        <Rectangle x:Name="FocusVisualElement"
                                   Margin="2"
                                   IsHitTestVisible="False"
                                   Opacity="0"
                                   RadiusX="1"
                                   RadiusY="1"
                                   Stroke="{StaticResource FocusVisualBrush}"
                                   StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                        <Border x:Name="ValidationErrorElement"
                                BorderBrush="{StaticResource ErrorBrush}"
                                BorderThickness="1"
                                CornerRadius="3"
                                Visibility="Collapsed">
                            <ToolTipService.ToolTip>
                                <ToolTip x:Name="validationTooltip"
                                         DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                         Placement="Right"
                                         PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                         Template="{StaticResource ValidationToolTipTemplate}">
                                    <ToolTip.Triggers>
                                        <EventTrigger RoutedEvent="Canvas.Loaded">
                                            <BeginStoryboard>
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsHitTestVisible">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="True" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </EventTrigger>
                                    </ToolTip.Triggers>
                                </ToolTip>
                            </ToolTipService.ToolTip>
                            <Grid Width="12"
                                  Height="12"
                                  Margin="1,-4,-4,0"
                                  HorizontalAlignment="Right"
                                  VerticalAlignment="Top"
                                  Background="Transparent">
                                <Path Margin="1,3,0,0"
                                      Data="M 1,0 L6,0 A 2,2 90 0 1 8,2 L8,7 z"
                                      Fill="{StaticResource ErrorBrush}" />
                            </Grid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>